home *** CD-ROM | disk | FTP | other *** search
- // c1997 by Stephan Kuhagen
- // stk@informatik.uni-bremen.de
- // mail me, send postcards, show me your pictures
-
- #ifndef ( OBJECTNAME)
- #declare OBJECTNAME = "TREE" // Name des Objects
- #end
-
- #ifndef ( USESTDTRUNK)
- #declare USESTDTRUNK = "YES" // Soll der Standardstamm benutzt werden ?
- #end
-
- #ifndef ( TRUNKLEN)
- #declare TRUNKLEN = "5" // LΣnge des Stammes (FLOAT, >0)
- #end
-
- #ifndef ( TRUNKBASER)
- #declare TRUNKBASER = "1" // Anfangsradius des Stammes (FLOAT, >0)
- #end
-
- #ifndef ( TRUNKCAPR)
- #declare TRUNKCAPR = "0.5" // Endradius des Stammes (FLOAT, >0)
- #end
-
- #ifndef ( DEPTH)
- #declare DEPTH = 4 // Rekursionstiefe (INT, >0)
- #end
-
- #ifndef ( BLEN)
- #declare BLEN = "5" // AnfangslΣnge (MindestlΣnge) der ─ste (FLOAT, >0)
- #end
-
- #ifndef ( LDIFF)
- #declare LDIFF = "0" // Differenzwert AstlΣnge (wird zu BLEN addiert) (FLOAT, LDIFF> -BLEN)
- #end
-
- #ifndef ( RADIUS)
- #declare RADIUS = "0.5" // Anfangsradius fⁿr ─ste (FLOAT, >0)
- #end
-
- #ifndef ( RADSCALE)
- #declare RADSCALE = "0.5" // Skalierungswert fⁿr Astradius (FLOAT, >0)
- #end
-
- #ifndef ( RDIFF)
- #declare RDIFF = "0" // Differenzwert fⁿr Astradius, wird von RADIUS subtrahiert (FLOAT, |RDIFF|<RADIUS)
- #end
-
- #ifndef ( RECSCALE)
- #declare RECSCALE = "0.5" // Skalierungswert fⁿr Rekursion (FLOAT, >0)
- #end
-
- #ifndef ( SLOPEANGLE)
- #declare SLOPEANGLE = "45" // Neigungswinkel der ─ste (FLOAT)
- #end
-
- #ifndef ( SANGLEDIFF)
- #declare SANGLEDIFF = "0" // Differenzwert fⁿr Neigungswinkel (wird zu SLOPEANGLE addiert) (FLOAT)
- #end
-
- #ifndef ( ANGLESCALE)
- #declare ANGLESCALE = "1" // Skalierungswinkel fⁿr Neigungswinkel (FLOAT)
- #end
-
- #ifndef ( NRBRANCHES)
- #declare NRBRANCHES = "4" // Anzahl ─ste (INT, >0) *** Funktion: PoV parsierbar, f(x)
- #end
-
- #ifndef ( NRBDIFF)
- #declare NRBDIFF = "0" // Differenzwert fⁿr Anzahl ─ste (wird zu NRBRANCHES addiert) (FLOAT)
- #end
-
- #ifndef ( NRBSCALEADD)
- #declare NRBSCALEADD = "0" // Skalierungswert fⁿr Anzahl ─ste (wird zu NRBRANCHES addiert)(FLOAT)
- #end
-
- #ifndef ( NRBSCALEMUL)
- #declare NRBSCALEMUL = "1" // Skalierungswert fⁿr Anzahl ─ste (wird mit NRBRANCHES multipliziert)(FLOAT)
- #end
-
- #ifndef ( BRANCHTOP)
- #declare BRANCHTOP = "1" // Wahrscheinlichkeitswert fⁿr Astansatzstelle (FLOAT, 0<=x<=1)
- #end
-
- #ifndef ( LEAFINC)
- #declare LEAFINC = "NO" // BlΣtterinclude (STRING, YES|NO)
- #end
-
- #ifndef ( NRLEAFINCS)
- #declare NRLEAFINCS = 0 // Anzahl Blattincludes (INT, >=0)
- #end
-
- #ifndef ( NRLEAFS)
- #declare NRLEAFS = "0" // Anzahl BlΣtter pro Ast (INT, >=0)
- #end
-
- #ifndef ( NRLDIFF)
- #declare NRLDIFF = "0" // Differenzwert Anzahl BlΣtter pro Ast (wird zu NRLEAFS addiert)(INT, NRLDIFF> -NRLEAFS)
- #end
-
- #ifndef ( ROTRANGE)
- #declare ROTRANGE = "360" // Rotationsrange (FLOAT, 0<=x<=360)
- #end
-
- #ifndef ( RANDINIT_ROT)
- #declare RANDINIT_ROT = "0.1234" // Initialisierungswert fⁿr Rotations-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_LDIFF)
- #declare RANDINIT_LDIFF = "0.1234" // Initialisierungswert fⁿr LDIFF-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_RDIFF)
- #declare RANDINIT_RDIFF = "0.1234" // Initialisierungswert fⁿr RDIFF-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_SDIFF)
- #declare RANDINIT_SDIFF = "0.1234" // Initialisierungswert fⁿr SANGLEDIFF-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_NRBDIFF)
- #declare RANDINIT_NRBDIFF = "0.1234" // Initialisierungswert fⁿr NRBDIFF-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_NRLDIFF)
- #declare RANDINIT_NRLDIFF = "0.1234" // Initialisierungswert fⁿr NRLDIFF-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_LEAFSELECT)
- #declare RANDINIT_LEAFSELECT = "0.1234" // Initialisierungswert fⁿr LEAFSELECT-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_LEAFTRANS)
- #declare RANDINIT_LEAFTRANS = "0.1234" // Initialisierungswert fⁿr LEAFTRANS-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_LEAFROT)
- #declare RANDINIT_LEAFROT = "0.1234" // Initialisierungswert fⁿr LEAFROT-Random (FLOAT)
- #end
-
- #ifndef ( RANDINIT_BT)
- #declare RANDINIT_BT = "0.1234" // Initialisierungswert fⁿr Branchtop-Random (FLOAT)
- #end
-
-
-
- // Default-Texture, muss vorhanden sein
- #default { pigment { color rgb <0.35, 0.16, 0.14> } }
-
-
-
- /*********************************************************************
-
- DO NOT CHANGE ANYTHING HERE
-
- *********************************************************************/
-
- /*
-
- // ▄berprⁿfung der Variablen NEU SCHREIBEN!!!!!!!!!!
-
- */
-
-
-
-
- /*********************************************************************
-
- Ab hier wird das eigentliche Include-File erzeugt:
-
- *********************************************************************/
-
- #debug "/*********************************************************************\n"
- #debug "\n"
- #debug concat(" Objectname: ",OBJECTNAME,"\n")
- #debug "\n"
- #debug "*********************************************************************/\n\n"
-
- // Initialisierung der Random-Streams
- #debug concat("#declare RANDROT_",OBJECTNAME," = seed(",RANDINIT_ROT,") // random for rotation\n")
- #debug concat("#declare RANDLDIFF_",OBJECTNAME," = seed(",RANDINIT_LDIFF,") // random for LDIFF\n")
- #debug concat("#declare RANDRDIFF_",OBJECTNAME," = seed(",RANDINIT_RDIFF,") // random for RDIFF\n")
- #debug concat("#declare RANDSDIFF_",OBJECTNAME," = seed(",RANDINIT_SDIFF,") // random for SANGLEDIFF\n")
- #debug concat("#declare RANDNRBDIFF_",OBJECTNAME," = seed(",RANDINIT_NRBDIFF,") // random for NRBDIFF\n")
- #debug concat("#declare RANDNRLDIFF_",OBJECTNAME," = seed(",RANDINIT_NRLDIFF,") // random for NRLDIFF\n")
- #debug concat("#declare RANDLEAFROT_",OBJECTNAME," = seed(",RANDINIT_LEAFROT,") // random for LEAFROT\n")
- #debug concat("#declare RANDLEAFTRANS_",OBJECTNAME," = seed(",RANDINIT_LEAFTRANS,") // random for LEAFTRANS\n")
- #debug concat("#declare RANDLEAFSELECT_",OBJECTNAME," = seed(",RANDINIT_LEAFSELECT,") // random for LEAFSELECT\n")
- #debug concat("#declare RANDBT_",OBJECTNAME," = seed(",RANDINIT_BT,") // random for BRANCHTOP\n\n")
-
-
-
- // Vars for Statistics
- #debug "#declare NROFCONES = 0\n"
- #debug "#declare NROFSPHERES = 0\n"
- #debug "#declare NROFLEAFS = 0\n\n"
-
-
-
- // Vars for backtracing rotations
- #debug "#declare BACKTRACER_X = 0\n"
- #debug "#declare BACKTRACER_Y = 0\n"
- #debug "#declare BACKTRACER_Z = 0\n\n"
- // Vars for backtracing translations
- #debug "#declare BACKTRACET_X = 0\n"
- #debug "#declare BACKTRACET_Y = 0\n"
- #debug "#declare BACKTRACET_Z = 0\n\n"
-
-
-
- // ╓ffnen der Union OBJECTNAME
- #declare INCDEPTH = 0
- #debug concat("#declare X = ",str(INCDEPTH,0,0),"\n")
- #debug "\n"
- #debug concat("#declare ",OBJECTNAME," =\n")
- #debug "union\n"
- #debug "{\n"
- #debug " // Baumstamm erzeugen\n"
-
- #if ( strcmp(USESTDTRUNK,"NO") != 0 )
- #debug " union\n"
- #debug " {\n"
- #debug concat(" cone { <0, 0, 0>, ",TRUNKBASER,", <0, ",TRUNKLEN,", 0>, ",TRUNKCAPR," }\n")
- #debug " #declare NROFCONES = NROFCONES + 1\n"
- #debug concat(" sphere { <0, ",TRUNKLEN,", 0>, ",TRUNKCAPR," }\n")
- #debug " #declare NROFSPHERES = NROFSPHERES + 1\n"
- #debug concat(" #ifdef ( MOD_TR )\n")
- #debug " // falls definiert, Texture Modifier einfⁿgen\n"
- #debug concat(" texture { MOD_TR }\n")
- #debug " #end\n"
- #debug " }\n"
- #else
- #debug " object\n"
- #debug " {\n"
- #debug " NEWTRUNK\n"
- #debug " }\n"
- #end
-
- // Erzeugung des Include-Files
- // Erste Schleifenrunde: ╓ffnen aller Rekursionsstufen
-
- #while ( INCDEPTH < DEPTH )
- #debug "// SchleifenzΣhler auf Anzahl (─ste+Differenz) und in\n"
- #debug "// AbhΣngigkeit v.d. aktuellen Rekursionsstufe setzen.\n"
- #debug concat("#declare X = ",str(INCDEPTH,0,0),"\n")
- #debug concat("#declare DEPTH_",str(INCDEPTH,0,0)," = (",NRBRANCHES,"+(rand(RANDNRBDIFF_",OBJECTNAME,")*",NRBDIFF,"))*pow(",NRBSCALEMUL,",",str(INCDEPTH,0,0),")+(",NRBSCALEADD,"*",str(INCDEPTH,0,0),")\n")
- #debug concat("#while ( DEPTH_",str(INCDEPTH,0,0)," > 0 )\n")
- #if ( INCDEPTH != DEPTH-1 )
- #debug concat(" // Rekursionsstufe: ",str(INCDEPTH,0,0),"\n")
- #debug " union\n"
- #debug " {\n"
- #debug " // Aktuellen Astradius berechnen\n"
- #debug concat(" #declare ACTRAD = (",RADIUS,"-(rand(RANDRDIFF_",OBJECTNAME,")*",RDIFF,"))*pow(",RADSCALE,",",str(INCDEPTH,0,0),") \n")
- #debug " // Aktuelle AstlΣnge berechnen\n"
- #debug concat(" #declare BLEN_",str(INCDEPTH,0,0)," = (",BLEN,"+(rand(RANDLDIFF_",OBJECTNAME,")*",LDIFF,"))*pow(",RECSCALE,",",str(INCDEPTH,0,0),")\n")
- #debug concat(" cone { <0, 0, 0>, ACTRAD, <0, BLEN_",str(INCDEPTH,0,0),", 0>, ACTRAD*(",RADSCALE,") }\n")
- #debug " #declare NROFCONES = NROFCONES + 1\n"
- #debug concat(" sphere { <0, BLEN_",str(INCDEPTH,0,0),", 0>, ACTRAD*(",RADSCALE,") }\n")
- #debug " #declare NROFSPHERES = NROFSPHERES + 1\n"
-
- #else
- #if ( strcmp(LEAFINC,"YES") = 0 )
- #debug " union\n"
- #else
- #debug " object\n"
- #end
- #debug " {\n"
- #debug " // Aktuellen Astradius berechnen\n"
- #debug concat(" #declare ACTRAD = (",RADIUS,"-(rand(RANDRDIFF_",OBJECTNAME,"))*",RDIFF,")*pow(",RADSCALE,",",str(INCDEPTH,0,0),") \n")
- #debug " // Unterste Astebene ohne abschlie▀ende Kugel\n"
- #debug concat(" #declare BLEN_",str(INCDEPTH,0,0)," = (",BLEN,"+(rand(RANDLDIFF_",OBJECTNAME,")*",LDIFF,"))*pow(",RECSCALE,",",str(INCDEPTH,0,0),")\n")
- #debug concat(" cone { <0, 0, 0>, ACTRAD, <0, BLEN_",str(INCDEPTH,0,0),", 0>, ACTRAD*",RADSCALE," }\n")
- #debug " #declare NROFCONES = NROFCONES + 1\n"
-
- #if ( strcmp(LEAFINC,"YES") = 0 )
- #debug " // BlΣtter erzeugen\n"
- #debug " // BlattzΣhler\n"
- #debug concat(" #declare LEAFCNT = ",NRLEAFS," + (int(rand(RANDNRLDIFF_",OBJECTNAME,")*",NRLDIFF,"))\n")
- #debug " #while ( LEAFCNT > 0 )\n"
- #debug " object\n"
- #debug " {\n"
- #debug " // Blatt auswⁿrfeln\n"
- #debug concat(" #switch( int( rand(RANDLEAFSELECT_",OBJECTNAME,") * (",NRLEAFS,"-1) ) )\n")
-
- #declare LCOUNT = 0
- #while ( LCOUNT < NRLEAFINCS )
- #debug concat(" #case ( ",str(LCOUNT,0,0)," )\n")
- #debug concat(" LEAFINC_",str(LCOUNT,0,0),"\n")
- #debug " #break\n"
- #declare LCOUNT = LCOUNT + 1
- #end
- #debug " #else\n"
- #debug " LEAFINC_0\n"
- #debug " #end\n"
- #debug " #declare NROFLEAFS = NROFLEAFS + 1\n"
- #debug " rotate <90, 0, 0>\n"
- #debug concat(" #declare randy = 360*rand(RANDLEAFROT_",OBJECTNAME,")\n")
- #debug concat(" rotate <0, randy, 0>\n")
- #debug concat(" translate <0, rand(RANDLEAFTRANS_",OBJECTNAME,")*BLEN_",str(INCDEPTH,0,0),", 0>\n")
- #debug " }\n"
- #debug " #declare LEAFCNT = LEAFCNT - 1\n"
- #debug " #end\n"
- #end
-
- #end
- #debug "\n"
- #declare INCDEPTH = INCDEPTH+1
- #end
-
-
- // Zweite Schleifenrunde, Texture-Modifier, transformationen, Schliessen der Rekursionsstufen
-
- #declare INCDEPTH = DEPTH-1
- #while ( INCDEPTH != -1 )
- #debug concat(" #ifdef ( MOD_",str(INCDEPTH,0,0)," )\n")
- #debug " // falls definiert, Texture Modifier einfⁿgen\n"
- #debug concat(" texture { MOD_",str(INCDEPTH,0,0)," }\n")
- #debug " #end\n"
- #debug " // Astneigung\n"
- #debug concat(" #declare randx = (",SLOPEANGLE,"+(rand(RANDSDIFF_",OBJECTNAME,")*",SANGLEDIFF,"))*pow(",ANGLESCALE,",",str(INCDEPTH-1,0,0),")\n")
- #debug concat(" rotate <randx, 0, 0>\n")
- #debug " // Innerhalb des Rotationsbereiches drehen\n"
- #debug concat(" #declare randy = ",ROTRANGE,"*rand(RANDROT_",OBJECTNAME,")\n")
- #debug concat(" rotate <0, randy, 0>\n")
- #if ( INCDEPTH > 0 )
- #debug " // am Ansatzast verschieben\n"
- #debug concat(" #if ( rand(RANDBT_",OBJECTNAME,") < ",BRANCHTOP," )\n")
- #debug " // an Astspitze verschieben\n"
- #debug concat(" translate <0, BLEN_",str(INCDEPTH-1,0,0),", 0>\n")
- #debug " #else\n"
- #debug " // an beliebigen Punkt verschieben\n"
- #debug concat(" translate <0, (BLEN_",str(INCDEPTH-1,0,0),")*rand(RANDBT_",OBJECTNAME,"), 0>\n")
- #debug " #end\n"
- #else
- #debug " // Ans Stammende des Baumes verschieben\n"
- #debug concat(" translate <0, ",TRUNKLEN,", 0>\n")
- #end
- #debug " }\n"
- #debug concat(" #declare DEPTH_",str(INCDEPTH,0,0)," = DEPTH_",str(INCDEPTH,0,0)," - 1\n")
- #debug "#end\n"
- #declare INCDEPTH = INCDEPTH-1
- #end
-
- // Schliessen der Union Tree
- #debug "}\n\n"
-
-
- // Ausgabe der Statistiken
- #debug "#statistics \"\\n\\n SELFTREE STATISTICS:\\n\" \n"
- #debug "#statistics \" --------------------------\\n\" \n"
- #debug concat("#statistics concat(\" Objectname : ",OBJECTNAME,"\\n\") \n")
- #debug "#statistics \" --------------------------\\n\" \n"
- #debug "#statistics concat(\" Number of cones : \",str(NROFCONES, 6, 0),\"\\n\") \n"
- #debug "#statistics concat(\" Number of spheres : \",str(NROFSPHERES, 6, 0),\"\\n\") \n"
- #debug "#statistics concat(\" Number of leafs : \",str(NROFLEAFS, 6, 0),\"\\n\") \n"
- #debug "#statistics \" --------------------------\\n\" \n"
- #debug "#statistics concat(\" Total : \",str(NROFLEAFS+NROFSPHERES+NROFCONES, 6, 0),\"\\n\") \n"
-
- #debug "\n\n\n\n\n"
-
-
-
-